<!-- 授权管理页面   12.15  wcf全文添加--------------------------- -->
<template>
	<div class="all">

		<span class="title">参数设置</span>
		<div class="content">
			<div class="items">

				<el-form>
					<el-form-item label="导入用户首次登录是否强制修改密码" style="display: flex;margin-top: 50px;">
						<el-checkbox v-model="value1" @change="editopen" :disabled="$permissions.indexOf(290)  == -1"></el-checkbox>
					</el-form-item>
					<el-form-item label="导入用户默认密码" style="display: flex;margin-top: 30px;">
						<el-input placeholder="请输入导入用户默认密码" :readonly="$permissions.indexOf(290)  == -1" style="width: 230px" v-model="value" @blur="subinfo5">
						</el-input>
					</el-form-item>
				</el-form>

			</div>
		</div>

	</div>
</template>
<script type="text/babel">


	export default {
		
		data() {
			return {
				value1:'',
				value:""
			};
		},
		components: {},

		created() {},

		mounted() {	
			this.getset()
			this.getset2()
		},
		methods: {
			subinfo5() {
				if (this.value.trim() == '') {
					this.$Toast('导入用户默认密码不能为空！');
					return
				}
				var that = this
				var param ={
					password:this.value
				}
				this.$http.post(this.$url + '/sysSet/updateUserDefaultPassword', this.$qs.stringify(param))
					.then(function(response) {
						if (response.data.code == '1410') {
							that.$message(response.data.msg);
							sessionStorage.setItem('token', '')
							that.$router.push('/login')
							return
						}
						that.$Toast(response.data.msg);
						that.getset2()
					})
					.catch(function(error) {
						console.log(error);
						that.$Toast('网络拥堵，刷新一下');
					});
			
			},
			editopen() {
				
				var that = this
				var param ={
					value:this.value1?1:0
				}
				this.$http.post(this.$url + '/sysSet/updateIsFirstLoginResetPass', this.$qs.stringify(param))
					.then(function(response) {
						if (response.data.code == '1410') {
							that.$message(response.data.msg);
							sessionStorage.setItem('token', '')
							that.$router.push('/login')
							return
						}
			
						that.$Toast(response.data.msg);
						that.getset()
					})
					.catch(function(error) {
						console.log(error);
						that.$Toast('网络拥堵，刷新一下');
					});
			
			},
			getset() {
				var that = this
				this.$http.get(this.$url + '/sysSet/selectIsFirstLoginResetPass')
					.then(function(response) {
						console.log(response);
					   
						if (response.data.code == '1410') {
								that.$Toast(response.data.msg);
								sessionStorage.setItem('token', '')
								that.$router.push('/login')
							return
						}
						that.value1=response.data==1?true:false
						
					})
					.catch(function(error) {
						console.log(error);
						that.$Toast('网络拥堵，刷新一下');
					});
			},
			getset2() {
				var that = this
				this.$http.get(this.$url + '/sysSet/selectUserDefaultPassword')
					.then(function(response) {
						console.log(response);
					   
						if (response.data.code == '1410') {
								that.$Toast(response.data.msg);
								sessionStorage.setItem('token', '')
								that.$router.push('/login')
							return
						}
						that.value=response.data
						
					})
					.catch(function(error) {
						console.log(error);
						that.$Toast('网络拥堵，刷新一下');
					});
			},
			},
        }
</script>

<style lang='less' scoped>
	* {
		margin: 0px;
		padding: 0px;
		list-style: none;
		font-family: 微软雅黑 !important;
	}

	.all {
		padding: 10px 30px;
		//background-color: #F3F3F4;
	}

	.title {

		color: #000;
		display: inline-block;
		/* width: 100px; */
		height: 48px;
		line-height: 48px;
		text-align: center;
		border-radius: 5px;
		border-bottom: none;
		font-size: 24px;
	}

	.content {
		width: 100%;
		//border-top:1px solid #DDDDDD ;
	}

	.items {
		max-width: 700px;
		padding: 10px;
		background-color: #fff;
		padding-right: 5%;
	}

	.item {
		margin-top: 20px;
	}

	.items p {
		font-size: 14px;
		color: #333;

	}



	.el-input__inner:hover {
		cursor: pointer;
		background-color: #EEE !important;
		color: #7A6164;
	}

	.el-input__inner:focus {
		outline: none;
	}

	.el-button--primary {
		margin-top: 10px;
		padding: 10px 15px;
	}

	.el-input__inner {
		background-color: #EEE !important;
		color: #717170;
		font-size: 14px;
	}

	.el-input__inner:focus {
		outline: none;
	}
</style>
<style>

</style>
